package org.activequant.data.util.series;

import java.util.List;

import org.activequant.core.domainmodel.SeriesSpecification;
import org.activequant.core.domainmodel.data.Quote;
import org.activequant.core.domainmodel.data.QuoteSeries;
import org.activequant.data.preparation.IChain;
import org.activequant.data.retrieval.IQuoteSeriesSource;
import org.activequant.data.retrieval.ISeriesDataSource;

/**
 * Series source which acts as proxy holding multiple series sources and applying
 * data preparation/transformation filters.<br/>
 * FilterQuoteSeriesSource extends FilterSeriesSource&lt;Quote, QuoteSeries&gt; implements IQuoteSeriesSource.<br/>
 * Holds the following inherited variables:
 * <ul>
 * <li>clazz(Class&lt;Quote&gt;)</li>
 * <li>map(List&lt;Entry&gt;)</li>
 * <li>chain(IChain)</li>
 * <li>data(QuoteSeries[])</li>
 * </ul>
 * <p>
 * <b>History:</b><br>
 *  - [29.02.2008] Created (Erik Nijkamp)<br>
 *
 *  @author Erik Nijkamp
 */
public class FilterQuoteSeriesSource extends FilterSeriesSource<Quote,QuoteSeries> implements IQuoteSeriesSource {
	/**
	 * constructs a FilterQuoteSeriesSource (extends FilterSeriesSource&lt;Quote, QuoteSeries&gt; implements IQuoteSeriesSource) whose inherited clazz(Class&lt;Quote&gt;) 
	 * is set to <strong>Quote.class</strong>
	 */
	public FilterQuoteSeriesSource() {
		super(Quote.class);
	}

	/**
	 * constructs a FilterQuoteSeriesSource (extends FilterSeriesSource&lt;Quote, QuoteSeries&gt; implements IQuoteSeriesSource) using the given chain(IChain) to set its inherited chain(IChain).<br/>
	 * Set its inherited clazz(Class&lt;Quote&gt;) to <strong>Quote.class</strong>.<br/>
	 * The given seriesSpecifications(SeriesSpecification[]) and dataSources(ISeriesDataSource&lt;QuoteSeries&gt;[]) must have the same length and are being used to
	 * create Entry elements and fill the inherited map(List&lt;Entry&gt;) with them.
	 * @param seriesSpecifications
	 * @param dataSources
	 * @param chain
	 */
	public FilterQuoteSeriesSource(SeriesSpecification[] seriesSpecifications, 
			ISeriesDataSource<QuoteSeries>[] dataSources,
			IChain chain) {
		super(Quote.class, seriesSpecifications, dataSources, chain);
	}
	/**
	 * returns a QuoteSeries[] array from the given list(List&lt;QuoteSeries&gt;)
	 */
	@Override
	protected QuoteSeries[] toArray(List<QuoteSeries> list) {
		return list.toArray(new QuoteSeries[] {});
	}

}
